﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _01_SquareRootValidation
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                int number = int.Parse(Console.ReadLine());
                if (number < 0)
                {
                    throw new ArgumentOutOfRangeException("Invalid number");
                }
                double squareRoot = Math.Sqrt(number);
                Console.WriteLine("The square root of {0} is {1}.", number, squareRoot);

            }
            catch (ArgumentOutOfRangeException e)
            {

                Console.WriteLine(e.Message);
            }
            catch (OverflowException e)
            {
                Console.WriteLine("Invalid number");
            }
            finally 
            {
                Console.WriteLine("Goodbye!");
            }
        }
    }
}
